import WxPay from "@/assets/wxpay.png";
import AliPay from "@/assets/alipay.png";
import UnionPay from "@/assets/yinlian.png";
import CashPay from "@/assets/xianjin.png";
import MemberPay from "@/assets/huiyuan.png";

export const paymentMethodApi = (type: string, index: number = 0, val?: string) => {
  const arr = [
    {
      icon: WxPay,
      title: "微信",
      paymentName: "WxPay",
    },
    {
      icon: AliPay,
      title: "支付宝",
      paymentName: "AliPay",
    },
    {
      icon: UnionPay,
      title: "银联",
      paymentName: "UnionPay",
    },
    {
      icon: CashPay,
      title: "现金",
      paymentName: "CashPay",
    },
    {
      icon: MemberPay,
      title: "会员余额",
      paymentName: "MemberPay",
    },
  ];
  // 返回全部：堂食点餐支付
  if (type === "001") {
    return arr;
  }
  // 根据下标返回paymentName字段
  if (type === "002") {
    return arr[index].paymentName;
  }
  // 根据paymentName字段返回title
  if (type === "003") {
    const selectedPayment = arr.find((item) => item.paymentName === val);
    return selectedPayment ? selectedPayment.title : "";
  }
};
// 员工身份
export const employeeRoleApi = (val: string) => {
  const arr = [
    {
      name: "总经理",
      type: "P1",
    },
    {
      name: "店长",
      type: "P2",
    },
    {
      name: "服务员",
      type: "P3",
    },
    {
      name: "厨师",
      type: "P4",
    },
    {
      name: "财务",
      type: "P5",
    },
    {
      name: "保洁",
      type: "P6",
    },
  ];
  const selectedName = arr.find((item) => item.type === val);
  return selectedName ? selectedName.name : "";
};
// 员工婚姻状态
export const maritalStatusApi = (val: string) => {
  const arr = [
    {
      name: "已婚",
      type: "M1",
    },
    {
      name: "未婚",
      type: "M2",
    },
    {
      name: "丧偶",
      type: "M3",
    },
    {
      name: "离异",
      type: "M4",
    },
  ];
  const selectedName = arr.find((item) => item.type === val);
  return selectedName ? selectedName.name : "";
};